Use a custom rm_rf to paper over windows git funkiness
authorAlex Crichton <alex@alexcrichton.com>
Fri, 27 Jun 2014 21:06:50 +0000 (14:06 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Sat, 28 Jun 2014 19:28:36 +0000 (12:28 -0700)
tests/support/mod.rs
tests/test_cargo_test.rs

index 39f5eef86a452ac41fbd1dd74e34d7873c68e860..ed802533c9aeceeba1a1c5fdb2452bfdc4343bd4 100644 (file)
@@ -12,6 +12,8 @@ use ham = hamcrest;
 use cargo::util::{process,ProcessBuilder};
 use cargo::util::ProcessError;
 
+use support::paths::PathExt;
+
 pub mod paths;
 
 /*
@@ -107,7 +109,7 @@ impl ProjectBuilder {
         try!(mkdir_recursive(&self.root));
 
         for file in self.files.iter() {
-          try!(file.mk());
+            try!(file.mk());
         }
 
         Ok(())
@@ -116,8 +118,7 @@ impl ProjectBuilder {
     fn rm_root(&self) -> Result<(), String> {
         if self.root.exists() {
             rmdir_recursive(&self.root)
-        }
-        else {
+        } else {
             Ok(())
         }
     }
@@ -137,7 +138,7 @@ pub fn mkdir_recursive(path: &Path) -> Result<(), String> {
 }
 
 pub fn rmdir_recursive(path: &Path) -> Result<(), String> {
-    fs::rmdir_recursive(path)
+    path.rm_rf()
         .with_err_msg(format!("could not rm directory; path={}",
                               path.display()))
 }
index ad47932e268555c71eb82388cdb9407b3c3f1d77..455b0ced638b4b92d9df3a8884aef5c3b63d35c1 100644 (file)
@@ -1,4 +1,4 @@
-use support::{project, execs, basic_bin_manifest, COMPILING};
+use support::{project, execs, basic_bin_manifest, COMPILING, cargo_dir};
 use hamcrest::{assert_that, existing_file};
 use cargo::util::process;
 
@@ -28,13 +28,13 @@ test!(cargo_test_simple {
         process(p.bin("foo")),
         execs().with_stdout("hello\n"));
 
-    assert_that(p.cargo_process("cargo-test"),
+    assert_that(p.process(cargo_dir().join("cargo-test")),
         execs().with_stdout(format!("{} foo v0.5.0 (file:{})\n\n\
                                     running 1 test\n\
                                     test test_hello ... ok\n\n\
                                     test result: ok. 1 passed; 0 failed; \
                                     0 ignored; 0 measured\n\n",
                                     COMPILING, p.root().display())));
-    
+
     assert_that(&p.bin("tests/foo"), existing_file());
 })